﻿namespace Vibstudio.NetConfigurator.UI.Model
{
    #region Namespaces

    using System.Collections.Generic;
    using System.Linq;

    using Vibstudio.NetConfigurator.Model;

    #endregion

    public sealed class ResultValidationUrlCollection : ResultCollectionBase<ResultValidationUrl>
    {
        #region Ctor(s)

        public ResultValidationUrlCollection(IEnumerable<ResultValidation<ConfigurationUrl>> collection)
            : base(AdaptResult(collection))
        {
        }

        #endregion

        #region Methods

        private static IEnumerable<ResultValidationUrl> AdaptResult(
            IEnumerable<ResultValidation<ConfigurationUrl>> collection)
        {
            return
                collection
                    .Select(r => new ResultValidationUrl(r.Owner, r.Target.Value, r.IsValid, r.Message))
                    .ToList();
        }

        #endregion
    }
}